//
//  MainTabBarViewController.swift
//  约健
//
//  Created by tyh on 2017/9/14.
//  Copyright © 2017年 tyh. All rights reserved.
//

import UIKit

class MainTabBarViewController: RDVTabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
  
              SetViewController()

        // Do any additional setup after loading the view.
    }
  
 
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    func SetViewController(){
        let findstoryboard: UIStoryboard = UIStoryboard(name: "FindStoryboard", bundle: nil)
        let findnaigationcontroller:UIViewController = findstoryboard.instantiateViewController(withIdentifier: "FindNav")
        
        let mestoryboard: UIStoryboard = UIStoryboard(name: "MeStoryboard", bundle: nil)
        let menaigationcontroller:UIViewController = mestoryboard.instantiateViewController(withIdentifier: "MeNav")
        
        
        let trainstoryboard: UIStoryboard = UIStoryboard(name: "TrainStoryboard", bundle: nil)
        let trainnaigationcontroller:UIViewController = trainstoryboard.instantiateViewController(withIdentifier: "TrainNav")
        
        
        self.viewControllers = [trainnaigationcontroller,findnaigationcontroller,menaigationcontroller]
        
        let tabBarItemImages = ["1","2","3"]
        let tabBarItemTitles = ["训练","发现","我的"]
        let tabBar = self.tabBar
        tabBar?.frame=CGRect(x: (tabBar?.frame.minX)!, y: (tabBar?.frame.minY)!, width: (tabBar?.frame.width)!, height: 65)
        self.tabBar?.isTranslucent = false
        
  
        var index:Int = 0
        for item in self.tabBar.items as! [RDVTabBarItem]{
            let selectrdimage = UIImage(named: "\(tabBarItemImages[index])"+"_Yes")
            let unselectrdimage = UIImage(named: "\(tabBarItemImages[index])"+"_No")
            
            item.setFinishedSelectedImage(selectrdimage, withFinishedUnselectedImage: unselectrdimage)
            item.title = tabBarItemTitles[index]
            index += 1
        }

        
    }
    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
